CMAKE_MINIMUM_REQUIRED(VERSION 3.17)

IF (NOT TARGET ZMQ::H)
    ADD_LIBRARY(ZMQ::H INTERFACE IMPORTED)
    TARGET_INCLUDE_DIRECTORIES(ZMQ::H INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/windows/include")
    TARGET_COMPILE_DEFINITIONS(ZMQ::H INTERFACE "ZMQ_STATIC")
ENDIF ()

IF (NOT TARGET ZMQ::LIB)
    FIND_LIBRARY(ZMQ_LIB NAMES libzmq-v142-mt-s-4_3_4 PATHS ${CMAKE_CURRENT_SOURCE_DIR}/windows/lib NO_DEFAULT_PATH)
    ADD_LIBRARY(ZMQ::LIB STATIC IMPORTED)
    SET_TARGET_PROPERTIES(ZMQ::LIB PROPERTIES IMPORTED_LOCATION "${ZMQ_LIB}")
ENDIF ()

IF (NOT TARGET LIBRARIES::ZMQ)
    ADD_LIBRARY(LIBRARIES::ZMQ INTERFACE IMPORTED GLOBAL)
    TARGET_LINK_LIBRARIES(LIBRARIES::ZMQ INTERFACE
            ZMQ::H
            ZMQ::LIB)
ENDIF ()